home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_1 / diff.eqs < prev    next >
Text File  |  1995-03-23  |  3KB  |  155 lines

  1. Article 3292 of comp.sys.handhelds:
  2. Path: ux1.cso.uiuc.edu!uwm.edu!cs.utexas.edu!sdd.hp.com!know!samsung!emory!gatech!prism!gt3398b
  3. From: gt3398b@prism.gatech.EDU (DELANO,ANDREW DOUGLAS)
  4. Newsgroups: comp.sys.handhelds
  5. Subject: DIFFERENTIAL EQUATIONS ON THE HP48SX
  6. Message-ID: <15047@hydra.gatech.EDU>
  7. Date: 12 Oct 90 03:08:16 GMT
  8. Organization: Georgia Institute of Technology
  9. Lines: 141
  10.  
  11.  
  12.  
  13. Here are some programs I wrote to do Euler's method, Improved
  14. Euler's method, Taylor series method, and Runge Kutta method
  15. for solving differential equations on the 48.  They were very
  16. useful in this quarters diffeqs class.  I hope somebody else
  17. out there finds them helpful.  I didn't know of any other progams
  18. like these existing so I wrote them myself.  If anybody else
  19. has any improvements, suggestions, or questions, please email
  20. me.  Also if I would be interested to know how many of you like
  21. them so if you do use them, please let me know.  Maybe somebody
  22. can put these on an ftp site for those who miss this.  Anyway,
  23. here are some genral instructions and the programs.
  24.  
  25.  
  26. 1. Download this directory into your hp48sx. (name it what you wish).
  27.  
  28. 2. There are 6 programs: EULR1,EULR2,TAYLr,R.K.,ENTR,PLT. You can
  29.    use EULR1, EULR2, TAYLr, and R.K. to solve equations.  ENTR and
  30.    PLT are utilities.
  31.  
  32. 3. Just press the method you wish and follow instructions.
  33.  
  34.                  GOOD LUCK
  35.  
  36.             Andy Delano
  37.  
  38. Here is the directory:
  39.  
  40. _________________________________________________________________________
  41.  
  42. %%HP: T(3)A(D)F(.);
  43. DIR
  44.   EULR1
  45.     \<< ENTR
  46.       DO DE EVAL h
  47. * Y + DUP 'Y' STO X
  48. h + 'X' STO X SWAP
  49. { 1 2 } \->ARRY \GS+
  50.       UNTIL X S ==
  51.       END { X Y DE
  52. h S IV XS } PURGE
  53. PLT
  54.     \>>
  55.   EULR2
  56.     \<< ENTR
  57.       DO DE EVAL
  58. DUP h * Y + Y SWAP
  59. 'Y' STO X h + 'X'
  60. STO DE EVAL SWAP
  61. 'Y' STO X h - 'X'
  62. STO + h 2 / * Y +
  63. DUP 'Y' STO X h +
  64. 'X' STO X SWAP { 1
  65. 2 } \->ARRY \GS+
  66.       UNTIL X S ==
  67.       END { X Y DE
  68. h S IV XS } PURGE
  69. PLT
  70.     \>>
  71.   TAYLr
  72.     \<< ENTR
  73.       DO DE 'X' \.d
  74. DE 'Y' \.d DE EVAL *
  75. + h 2 ^ 2 / * DE
  76. EVAL h * + Y + DUP
  77. 'Y' STO X h + 'X'
  78. STO X SWAP { 1 2 }
  79. \->ARRY \GS+
  80.       UNTIL X S ==
  81.       END { X Y DE
  82. h S IV XS } PURGE
  83. PLT
  84.     \>>
  85.   R.K.
  86.     \<< ENTR
  87.       DO DE EVAL
  88. 'K1' STO h .5 * X +
  89. 'X' STO Y DUP .5 h
  90. * K1 * + 'Y' STO DE
  91. EVAL 'K2' STO DUP
  92. .5 h * K2 * + 'Y'
  93. STO DE EVAL 'K3'
  94. STO .5 h * X + 'X'
  95. STO DUP h K3 * +
  96. 'Y' STO DE EVAL
  97. 'K4' STO 'Y' STO X
  98. h - 'X' STO K1 2 K2
  99. * 2 K3 * K4 + + + h
  100. 6 / * Y + 'Y' STO X
  101. h + 'X' STO X Y { 1
  102. 2 } \->ARRY \GS+
  103.       UNTIL X S ==
  104.       END { K4 K3
  105. K2 K1 X Y DE h XS S
  106. IV } PURGE PLT
  107.     \>>
  108.   ENTR
  109.     \<<
  110. "Enter Equation
  111. y'=:"
  112. "''" INPUT
  113. "Enter Step Size (h):"
  114. "" INPUT
  115. "Enter X Startpoint:"
  116. "" INPUT
  117. "Enter X Endpoint:"
  118. "" INPUT
  119. "Enter Intial
  120. Value(X,Y):"
  121. "()" INPUT OBJ\->
  122. 'IV' STO OBJ\-> 'S'
  123. STO OBJ\-> 'XS' STO
  124. OBJ\-> 'h' STO OBJ\->
  125. 'DE' STO IV V\-> 'Y'
  126. STO 'X' STO '\GSDAT'
  127. PURGE X Y { 1 2 }
  128. \->ARRY \GS+ XS 'X' STO
  129. CLLCD
  130. "    Please Wait..."
  131. 2 DISP 0 FREEZE
  132.     \>>
  133.   PLT
  134.     \<<
  135. "Would you like
  136. to plot the results?
  137. (Y/N)"
  138. "" INPUT 'a' STO
  139.       IF a "Y" ==
  140.       THEN ERASE
  141. SCATRPLOT GRAPH
  142.       ELSE
  143.       END \GSDAT {
  144. \GSPAR PPAR a } PURGE
  145.     \>>
  146. END
  147. -- 
  148. DELANO,ANDREW DOUGLAS
  149. Georgia Institute of Technology, Atlanta Georgia, 30332
  150. uucp:      ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt3398b
  151. Internet: gt3398b@prism.gatech.edu
  152.  
  153.  
  154.  
  155.